@props([
    'data',
    'paddingLeft' => 0,
])
@php
    use Filament\Actions\Action;
        $actions = [
            Action::make('edit')->label('编辑')->icon('heroicon-m-pencil-square')->link()->url(fn (): string => static::$resource::getUrl('edit', ['record' => $data])),
//            ->label('编辑')
//            ->icon('heroicon-m-pencil-square')
            // Action::make('编辑')->icon('heroicon-m-pencil-square')->link()->url(fn (): string => $this->getRes()::getUrl('edit', ['record' => $data])),
            $this->deleteAction()
        ];

@endphp

<tr class="bg-white">
    <!-- Simplicity is an acquired taste. - Katharine Gerould -->
    <td class="fi-ta-cell p-0 first-of-type:ps-1 last-of-type:pe-1 sm:first-of-type:ps-3 sm:last-of-type:pe-3 fi-table-cell-name">
        <div class="fi-ta-col-wrp">
            <div class="fi-ta-text grid w-full gap-y-1 px-3 py-4">
                <div class="flex">
                    <div class="fi-ta-text-item-label text-sm leading-6 text-gray-950"
                         style="padding-left: {{$paddingLeft}}px">
                        {{ $data->name}}
                    </div>
                </div>


            </div>

        </div>
    </td>
    <td class="fi-ta-cell p-0 first-of-type:ps-1 last-of-type:pe-1 sm:first-of-type:ps-3 sm:last-of-type:pe-3 fi-table-cell-name">
        <div class="fi-ta-col-wrp">
            <div class="fi-ta-text grid w-full gap-y-1 px-3 py-4">
                <div class="flex">
                    <div class="fi-ta-text-item-label text-sm leading-6 text-gray-950  ">

                        {{ $data->sort}}
                    </div>
                </div>

            </div>

        </div>
    </td>
    <td class="fi-ta-cell p-0 first-of-type:ps-1 last-of-type:pe-1 sm:first-of-type:ps-3 sm:last-of-type:pe-3 fi-table-cell-name">
        <div class="fi-ta-col-wrp">
            <div class="fi-ta-text grid w-full gap-y-1 px-3 py-4">
                <div class="flex justify-end">
                    <div class="fi-ta-text-item-label text-sm leading-6 text-gray-950">
                        @if (count($actions))
                            <div class="dd-nodrag ml-auto rtl:ml-0 rtl:mr-auto">
                                @foreach ($actions as $action)
                                    {{ ($action)(['data'=>$data->id]) }}
                                @endforeach
                            </div>
                        @endif
                    </div>
                </div>

            </div>

        </div>
    </td>
</tr>
@if($data->children)

    @foreach($data->children as $child)
        <x-tree-item :data="$child" :paddingLeft="$paddingLeft + 26"></x-tree-item>
    @endforeach

@endif
